import java.util.ArrayList;
import java.util.Scanner;


class s{
    String name="12";
    String studentNumber="114514";
}
public class StudentSystem {
    ArrayList studentData = new ArrayList();
    boolean State=true;


    public static void main(String[] args) {
        StudentSystem system=new StudentSystem();
        s ssd=new s();

        system.studentData.add(ssd);
        Scanner sc=new Scanner(System.in);

        System.out.println("功能 1：新增同学的信息\n" +
                "\n" +
                "功能 2： 更新所有同学的年龄信息\n" +
                "\n" +
                "功能 3 ：展示所有同学信息\n" +
                "\n" +
                "功能 4：输入一个学生学号，展示当前学号的学生所有的信息\n" +
                "\n" +
                "功能 5: 退出");
        while (system.State){
            System.out.println("请输入管理系统指令");
            int nowNumber=sc.nextInt();
            if(nowNumber==1){

                System.out.println("请输入新增同学的名字");
                String name=sc.next();
                System.out.println("请输入新增同学的学号");
                String number=sc.next();
                system.addStudent(name,number);

            }else if(nowNumber==2){

                System.out.println("所有同学的年龄更新完毕");

            } else if (nowNumber==3) {

                system.showAllStudentData();

            } else if (nowNumber==4) {

                System.out.println("请输入要查找的学号");
                system.getStudentNumberMessage(sc.next());

            } else if (nowNumber==5) {

                system.exit();

            }
        }


    }


    public void addStudent(String names,String stutendName){
        s st=new s();
        st.name=names;
        st.studentNumber=stutendName;
        this.studentData.add(st);
    }
    public void toNewAge(){

    }
    public void showAllStudentData(){
        System.out.println("以下为所有同学的数据");

        for (int i=0;i<this.studentData.size();i++){
            System.out.println("姓名:"+((s)(this.studentData.get(i))).name);
            System.out.println("学号:"+((s)(this.studentData.get(i))).studentNumber);
            System.out.println("--------------------------------");
        }
    }
    public void getStudentNumberMessage(String studentNumber){
        for (int i=0;i<this.studentData.size();i++){
            if(((s)(this.studentData.get(i))).studentNumber.equals(studentNumber)){
                System.out.println("查找到学号的是");
                System.out.println("姓名:"+((s)(this.studentData.get(i))).name);
                System.out.println("学号:"+((s)(this.studentData.get(i))).studentNumber);
            }

        }
    }
    public void exit(){
        this.State=false;
        System.out.println("已退出，感谢您的使用");
    }
}
